package org.ztr.aiollama.config;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: ZhaoTR
 * @Date: Created in 2025/9/20 19:44
 * @Description: 页面跨域配置
 * @Version: 1.0
 */
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {

    private static final Logger logger = LogManager.getLogger(MvcConfiguration.class);

    @Override
    public void addCorsMappings(CorsRegistry registry){
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
                .allowedHeaders("*")
                .exposedHeaders("Content-Disposition");
    }
}
